use serde::{Serialize, Serializer};

#[derive(Debug, Default, Serialize, Copy, Clone)]
pub enum ErrCode {
    Unknown = -1,
    #[default]
    Ok = 0,
}

/// 枚举类型值序列化为 i32
pub fn errcode_to_i32<S>(enum_value: &ErrCode, serializer: S) -> Result<S::Ok, S::Error>
where
    S: Serializer,
{
    serializer.serialize_i32(*enum_value as i32)
}
